#include <stdio.h>
#include <string.h>


int main(int argc, const char *argv[])
{
	FILE *fp=fopen("1.txt","a+");
	char writebuf[128]={0};


//	scanf("%s",writebuf);
//	fgets(writebuf,128,stdin);


//	fwrite(writebuf,strlen(writebuf),1,fp);
//	fputs(writebuf,fp);
	fprintf(fp,"nihao");

//	rewind(fp);
	fseek(fp,0,SEEK_SET);


	char readbuf[128]={0};


	/*
	fread(readbuf,sizeof(readbuf),1,fp);
	printf("%s\n",readbuf);
*/
	fgets(readbuf,128,fp);
	printf("fgets : %s\n",readbuf);
	fgets(readbuf,128,fp);
	printf("fgets : %s\n",readbuf);
	fgets(readbuf,128,fp);
	printf("fgets : %s\n",readbuf);



	return 0;
}
